﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Model.Entity;

namespace OnlineNewsEditorial_DaoLibrary.Impl
{
    public class JobAssignmentDao:AbstractDao<JobAssignment>
    {
        public override List<JobAssignment> getAll()
        {
            try
            {
                var q = from ja in _ctx.JobAssignments
                        select ja;
                return q.ToList<JobAssignment>();
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        public JobAssignment getById(Employee employee, Division division, DateTime dateTime)
        {
            try
            {
                var q = from ja in _ctx.JobAssignments
                        where ja.Employee.Equals(employee) && ja.Division.Equals(division) && ja.dateStart.Equals(dateTime)
                        select ja;
                return q.Single<JobAssignment>();
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        public JobAssignment getById(String empId, String divId, DateTime dateTime)
        {
            try
            {
                var q = from ja in _ctx.JobAssignments
                        where ja.empId.Equals(empId) && ja.divId.Equals(divId) && ja.dateStart.Equals(dateTime)
                        select ja;
                return q.Single<JobAssignment>();
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        public List<JobAssignment> getByEmployee(Employee employee)
        {
            return null;
        }

        public List<JobAssignment> getByEmployee(String empId)
        {
            return null;
        }

        public List<JobAssignment> getByDivision(Division division)
        {
            return null;
        }

        public List<JobAssignment> getByDivision(String divId)
        {
            return null;
        }

        public List<JobAssignment> getByStartDate(DateTime dateTime)
        {
            return null;
        }

        public List<JobAssignment> getByEmployeeAndDivision(Employee employee, Division division)
        {
            return null;
        }

        public List<JobAssignment> getByEmployeeAndDivision(String empId, String divId)
        {
            return null;
        }

        
    }
}
